---
title: "Spring Boot Logging"
date: 2019-10-18
categories:
- java
- spring
tags:
---

<div id="content">
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org77c71cf">Spring boot default logging</a></li>
</ul>
</div>
</div>
<blockquote>
<p>
<a href="https://howtodoinjava.com/spring-boot2/logging/logging-application-properties/">https://howtodoinjava.com/spring-boot2/logging/logging-application-properties/</a>
</p>
</blockquote>
<div class="outline-2" id="outline-container-org77c71cf">
<h2 id="org77c71cf">Spring boot default logging</h2>
<div class="outline-text-2" id="text-org77c71cf">
<pre class="example">
2017-03-02 23:33:51.318  INFO 3060 --- [nio-8080-exec-1] c.h.app.controller.IndexController       : info log statement printed
2017-03-02 23:33:51.319  WARN 3060 --- [nio-8080-exec-1] c.h.app.controller.IndexController       : warn log statement printed
2017-03-02 23:33:51.319 ERROR 3060 --- [nio-8080-exec-1] c.h.app.controller.IndexController       : error log statement printed
</pre>
<p>
Note down the observation that Default logging level is INFO – because debug log message is not present.
There is fixed default log message pattern which is configured in different base configuration files.
</p>
<pre class="example">{% raw %} 
%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %clr{${LOG_LEVEL_PATTERN}} %clr{${sys:PID}}{magenta} 
%clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}
 {% endraw %}</pre>
<p>
The above pattern print these listed log message parts with respective color coding applied:
</p>
<ul class="org-ul">
<li>Date and Time — Millisecond precision.</li>
<li>Log Level — ERROR, WARN, INFO, DEBUG or TRACE.</li>
<li>Process ID.</li>
<li>A — separator to distinguish the start of actual log messages.</li>
<li>Thread name — Enclosed in square brackets (may be truncated for console output).</li>
<li>Logger name — This is usually the source class name (often abbreviated).</li>
<li>The log message</li>
</ul>
</div>
</div>
</div>
<div class="status" id="postamble">
<p class="date">Date: 2019-10-18</p>
<p class="author">Author: gdme1320</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
